#!/bin/bash
#参考钉钉文档 https://open-doc.dingtalk.com/microapp/serverapi2/qf2nxq
#${dingding_token} 钉钉群里拿到token
#dingding-soanr.sh example:com.yh.csx.crm:csx-b2b-crm

time3=$(date "+%Y-%m-%d %H:%M:%S")

 sonarreport=$(curl -s http://192.168.1.21:8901/?projectname=$1)
 curl -s "https://oapi.dingtalk.com/robot/send?access_token=${dingding_token}" \
   -H "Content-Type: application/json" \
   -d "{
     \"msgtype\": \"markdown\",
     \"markdown\": {
         \"title\":\"sonar代码质量\",
         \"text\": \"## sonar代码质量报告: \n
> [$1 项目报告地址](http://192.168.1.28:9000/dashboard?id=$1) \n
> **${sonarreport}** \n \n> ![screenshot](https://demo.com/default/bugha.png
)\n> ###### ($time3)检查 [去看看](http://192.168.1.28:9000/dashboard?id=$1) \n\"
     }
 }"